4ef997
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hive.metastore;
 
 import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME;
+import static org.apache.hadoop.hive.metastore.MetaStoreUtils.isIndexTable;
 
 import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
@@ -463,7 +464,11 @@
public void dropDatabase(String name, boolean deleteData, boolean ignoreUnknownD
     if (cascade) {
        List<String> tableList = getAllTables(name);
        for (String table : tableList) {
+         try {
             dropTable(name, table, deleteData, false);
+         } catch (UnsupportedOperationException e) {
+           // Ignore Index tables, those will be dropped with parent tables
+         }
         }
     }
     client.drop_database(name, deleteData, cascade);
@@ -546,7 +551,7 @@
public void dropTable(String tableName, boolean deleteData)
    */
   public void dropTable(String dbname, String name, boolean deleteData,
       boolean ignoreUknownTab) throws MetaException, TException,
-      NoSuchObjectException {
+      NoSuchObjectException, UnsupportedOperationException {
 
     Table tbl;
     try {
@@ -557,6 +562,9 @@
public void dropTable(String dbname, String name, boolean deleteData,
       }
       return;
     }
+    if (isIndexTable(tbl)) {
+      throw new UnsupportedOperationException("Cannot drop index tables");
+    }
     HiveMetaHook hook = getHook(tbl);
     if (hook != null) {
       hook.preDropTable(tbl);
